
    import * as React from 'react';
    import * as ReactDOM from 'react-dom';
    import * as Reflux from 'reflux';
    var $ = require("jquery");
    //var $ = require("../../bower_components/jquery-2.1.4.min/index.js");

    var AjaxActions = Reflux.createActions([
        'get', 'post'
    ]);


    var AjaxStore = Reflux.createStore({
        items: {},
        listenables: [AjaxActions],
        onGet: function (url, model, param) {

            $.get(url, model, function (data) {

                data = JSON.parse(data);
                //console.log("get 数据")

                //console.log(data)
                if (data.resultCode == "0") {
                    this.items = data;
                    this.trigger(this.items);
                } else {
                    this.items = data;
                    this.trigger(this.items);
                }
                //console.log(data);
                return false;

            }.bind(this));
        },
        onPost: function (url, model, param) {

            $.post(url, model, function (data) {

                data = JSON.parse(data);
                if (data.resultCode == "0") {
                    this.items = data;
                    this.trigger(this.items);
                } else {
                    this.items = data;
                    this.trigger(this.items);
                }
                //console.log(data);
                return false;

            }.bind(this));
        }
    });


    /*textarea插件*/

    module.exports =  {
        AjaxStore: AjaxStore,
        AjaxActions: AjaxActions
    }

